package com.ruoyi.food.controller;
/**
 * 附件controller
 * @author mengcc
 *
 */

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.AjaxResult.Type;
import com.ruoyi.food.service.TAttachService;

@Controller
@RequestMapping("/tAttach")
public class TAttachController extends BaseController{
	@Autowired
	private TAttachService tAttachService;
	@PostMapping("/delete")
	@ResponseBody
	public AjaxResult delete(@RequestBody List<Long> attIds) {
		if(!attIds.isEmpty()) {
			tAttachService.deleteTAttachById(attIds);
			return new AjaxResult(Type.SUCCESS, "删除附件成功");
		}else {
			return new AjaxResult(Type.ERROR, "删除附件失败");
		}
		
	}
	
	@PostMapping("/setLogo")
	@ResponseBody
	public AjaxResult setLogo(long attId,long enterpriseId) {
		tAttachService.setLogo(attId, enterpriseId);
		return new AjaxResult(Type.SUCCESS, "设置logo成功");
	}

}
